/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
function validateCategory() {
    var xmlhttp = new XMLHttpRequest();
    category = document.getElementById("cat").value;
    // keyword=document.search.data.value;
    xmlhttp.open("POST", "categoryChecker", true);
    data = "category=" + category;
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.send(data);
    xmlhttp.onreadystatechange = function()
    {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
        {
            if(xmlhttp.responseText=="Category is Available")
            {
                alert("inside");
                document.getElementById("caterror").innerHTML = xmlhttp.responseText;
            }
        
            else if (xmlhttp.responseText=="Done")
            {
                alert("outside")
                window.location = "AdminMainCategory";
            }
        
        }
    };

}


